import React, { Component } from 'react'
import { connect } from 'react-redux'
import store from './store'
export class cgi extends Component {
    state = {
        count: 1
    }
    componentDidMount() {
        store.subscribe(() => {
            console.log('发布通知成功', store.getState().count)

            this.setState({
                count: store.getState().count
            })
        })
    }
    render() {
        return (
            <div>{this.state.count}</div>
        )
    }
}

//往实例父组件里面添加公共参数  第一个公共参数 第二个传公共函数
export default connect({ a: 1 }, {
    a() {

    }
})(cgi) //数据全部porps中
